/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.srcptit.trainning.huongpq.btvn2;

import java.util.Scanner;

/**
 *
 * @author Admin_Pro
 */
public class IO {

    public static int initInt() {
        int n;
        while (true) {
            try {
                Scanner sc = new Scanner(System.in);
                System.out.println("nhap so kieu int: ");
                n = sc.nextInt();
                break;
            } catch (Exception e) {
                System.out.println("nhap lai so nguyen int: ");
            }
        }
        return n;
    }

    public static long initLong() {
        long n;
        while (true) {
            try {
                Scanner sc = new Scanner(System.in);
                n = sc.nextLong();
                break;
            } catch (Exception e) {
                System.out.println("nhap lai so nguyen kieu long: ");
            }
        }
        return n;
    }

    public static float initFloat() {
        float n;
        while (true) {
            try {
                Scanner sc = new Scanner(System.in);
                n = sc.nextFloat();
                break;
            } catch (Exception e) {
                System.out.println("nhap lai so nguyen float: ");
            }
        }
        return n;
    }

    public static double initDouble() {
        double n;
        while (true) {
            try {
                Scanner sc = new Scanner(System.in);
                n = sc.nextDouble();
                break;
            } catch (Exception e) {
                System.out.println("nhap lai so nguyen double: ");
            }
        }
        return n;
    }

    public static String initString() {
        String n;
        while (true) {
            try {
                Scanner sc = new Scanner(System.in);
                n = sc.next();
                break;
            } catch (Exception e) {
                System.out.println("nhap lai day: ");
            }
        }
        return n;
    }

    public static String initStringLine() {
        String n;
        while (true) {
            try {
                Scanner sc = new Scanner(System.in);
                n = sc.nextLine();
                break;
            } catch (Exception e) {
                System.out.println("nhap lai day: ");
            }
        }
        return n;
    }

}
